package com.leetcode.math;

import java.util.Scanner;

public class PalindromeNumber {

	public static void main(String[] args){
		int x=1;
		//System.out.println(isPalindrome(x));
		Scanner in=new Scanner(System.in);
		int xx=in.nextInt();
		while(xx!=0){
		System.out.println(isPalindrome(xx));
		xx=in.nextInt();
		}
	}
	public static boolean isPalindrome(int x){
		int sum=0;
		int temp=x;
		while(x!=0){
			sum=sum*10+x%10;
			x/=10;
		}
		if(temp==sum){
			return true;
		}else
			return false;
		
	}
	public static boolean isPalindrome0(int x){
		boolean flag=false;
		int n=x,k=1;
		while(x>0){
			k=1;
			int right=x%10;
			while(n>=10){
				n/=10;
				k*=10;
			}
			int left=n;
			if(left!=right){
				break;
			}
			int temp=x%1000;
			x=(x%k)/10;
			if(x<temp) break;
			n=x;
			
		}
		if(x==0) flag=true;
		return flag;
	}
}
